package pl.edu.project.view;

import java.awt.Container;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;

@SuppressWarnings("serial")
public class About extends JDialog {
    private JLabel author1;
    private JLabel author2;
    private JLabel authors;
    private JLabel dataBase;
    private JLabel description;
    private JLabel descrpitonHeader;
    private JLabel formatsHeader;
    private JLabel outlook;
    private JLabel title;
    private JLabel version;
    private JLabel xml;

    public About(JFrame owner) {
	super(owner, "O programie");
	setSize(00, 150);
	setLocation(owner.getLocation());
	setDefaultCloseOperation(DISPOSE_ON_CLOSE);

	setData();
	initData(getContentPane());

	setResizable(false);
	setVisible(true);
	pack();
    }

    private void initData(Container pane) {
	pane.setLayout(new GridBagLayout());
	GridBagConstraints c = new GridBagConstraints();
	c.fill = GridBagConstraints.HORIZONTAL;
	c.insets.set(1, 5, 1, 5);
	title.setFont(new Font("Tahoma", Font.BOLD, 25));
	c.gridwidth = 2;
	c.gridx = 0;
	c.gridy = 0;
	add(title, c);

	c.gridy = 1;
	add(version, c);

	c.gridwidth = 1;
	c.gridy = 3;
	add(authors, c);

	c.gridx = 1;
	add(author1, c);

	c.gridy = 4;
	add(author2, c);

	c.gridx = 0;
	c.gridwidth = 1;
	c.gridy = 5;
	add(descrpitonHeader, c);

	c.gridx = 1;
	c.gridy = 8;
	add(description, c);

	c.gridx = 0;
	c.gridwidth = 1;
	c.gridy = 9;
	add(formatsHeader, c);

	c.gridx = 1;
	c.gridy = 10;
	add(xml, c);

	c.gridx = 1;
	c.gridy = 11;
	add(outlook, c);

	c.gridx = 1;
	c.gridy = 12;
	add(dataBase, c);

    }

    private void setData() {
	this.title = new JLabel("Calendar");
	this.version = new JLabel("v 1.1");
	this.authors = new JLabel("Authors:");
	this.author1 = new JLabel("Katarzyna Bia�kowska");
	this.author2 = new JLabel("Mariusz Stasiak");
	this.descrpitonHeader = new JLabel("Description:");
	this.description = new JLabel("Small Java Calendar application");
	this.formatsHeader = new JLabel("Works with: ");
	this.xml = new JLabel("- XML file");
	this.outlook = new JLabel("- Outlook format");
	this.dataBase = new JLabel("- SQLite database");
    }
}
